---
title: PdfMerger
summary: API reference for PdfMerger.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-09-17
library: PdfAPI.SyncFusionCore
reference_type: package
---

# PdfMerger

`PdfMerger` is the only non-static, instance-based public type in this library. It merges multiple document ranges into a single PDF, always performing the merge itself at no conformance, and applying PDF/A only as an optional post-merge pass whose failure is logged (via the injected `ILogService`) rather than surfaced to the caller. It is constructed directly by `SyncfusionPdfService` in the consuming `PdfAPI` application, not resolved through a dependency-injection container internal to this library.

## Purpose
- Merge a set of document ranges — whole documents or extracted page subsets — into one PDF
  ([BR-SFC-030](../../business-rules.md#br-sfc-030-whole-file-or-extracted-subset-per-range)).
- Always perform the merge at no conformance, regardless of the caller's PDF/A option
  ([BR-SFC-029](../../business-rules.md#br-sfc-029-merge-performed-at-no-conformance)).
- Apply PDF/A as a best-effort post-merge pass whose failure is logged as a warning rather than
  failing the whole operation ([BR-SFC-032](../../business-rules.md#br-sfc-032-pdf%2Fa-merge-failure-logged-as-warning)).
- Always report the merge result as succeeded, even when the PDF/A upgrade failed
  ([BR-SFC-033](../../business-rules.md#br-sfc-033-merge-result-always-reported-succeeded)).

## Context
- Namespace: `PdfAPI.SyncFusionCore`
- Assembly/package: `PdfAPI.SyncFusionCore` (`Pdf.Local.Client` NuGet package)

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| PdfMerger | `PdfMerger(IEnvironmentService envService, ILogService logService)` | Constructs the merger with the caller-supplied environment and log services, both from `SAIF.Framework.Core`, used respectively for diagnostic context and to log a PDF/A upgrade failure. |
| Merge | `PdfResult Merge(MergeRequest request, long? trackingId)` | Executes [Merge document ranges into one PDF](../../operations/merge-document-ranges-into-one-pdf.md) (OP-SFC-012): merges every `DocumentRange` in `request.DocumentRanges`, optionally upgrades the result to PDF/A, and returns a `PdfResult` stamped `Status = Succeeded`, `PdfProcessorType = Syncfusion`, with `Elapsed`, `ImageId` (parsed from `request.SourceSystemId`), and `TrackingId`. |

## Behavioral notes
- Any failure during the initial merge (before the optional PDF/A pass) propagates directly to the
  caller — there is no surrounding `catch` for that part of the operation ([BR-SFC-028](../../business-rules.md#br-sfc-028-extraction-and-merge-failures-propagate)).
- A failure only in the post-merge PDF/A pass is caught, logged via
  `PdfHelper.GetApplicationDetail` and `ILogService.LogException`, and does not fail the merge; the non-conformant PDF is returned instead ([BR-SFC-032](../../business-rules.md#br-sfc-032-pdf%2Fa-merge-failure-logged-as-warning)).
- `request.SourceSystemId` is parsed into `ImageId` via `long.TryParse`
  ([BR-SFC-009](../../business-rules.md#br-sfc-009-source-system-id-parsed-to-numeric-image-id)).

## Constraints and usage notes
- Requires an `IEnvironmentService` and `ILogService` (both from `SAIF.Framework.Core`) to be
  supplied at construction; there is no parameterless constructor.

## Related documentation
- [API reference](../index.md)
- [Operations and processes](../../operations-processes.md)
- [Business rules](../../business-rules.md)

## Sources
- `PdfApi.SyncFusionCore\Merge\PdfMerger.cs`
